package com.thinkgsp.sys.model;

import java.sql.Date;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

/**
 * 编码规则表
 * @author evan
 *
 */
public class SysNumberRole extends SysModel {

	private static final long serialVersionUID = -425276879681029036L;
	/**
	 * 递增值按年轮回
	 */
	public static final String INCREMENT_BY_YEAR = "BY_YEAR";
	/**
	 * 递增至按月轮回
	 */
	public static final String INCREMENT_BY_MONTH = "BY_MONTH";
	/**
	 * 递增至按日轮回
	 */
	public static final String INCREMENT_BY_DAY = "BY_DAY";

	private Integer id;
	private String roleName;
	private String roleFormat;
	private String incrementType;
	private Integer incrementVal;
	private Integer initVal;
	private Long curVal;
	private Date refDate;
	private String description;
	
	/**
	 * Id
	 * @return
	 */
	public Integer getId() {
		return id;
	}

	/**
	 * 编码规则名称
	 * @return
	 */
	public String getRoleName() {
		return roleName;
	}
	/**
	 * 编码规格格式,按Java format
	 * @return
	 */
	public String getRoleFormat() {
		return roleFormat;
	}

	/**
	 * 序列值递增值参考类型:按年循环；按月循环；按日循环
	 * @return
	 */
	public String getIncrementType() {
		return incrementType;
	}
	/**
	 * 递增值
	 * @return
	 */
	public Integer getIncrementVal() {
		return incrementVal;
	}
	/**
	 * 初始值
	 * @return
	 */
	public Integer getInitVal() {
		return initVal;
	}
	/**
	 * 当前值
	 * @return
	 */
	public Long getCurVal() {
		return curVal;
	}
	/**
	 * 递增值参考日期
	 * @return
	 */
	public Date getRefDate() {
		return refDate;
	}
	/**
	 * 规则描述
	 * @return
	 */
	public String getDescription() {
		return description;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}

	public void setRoleFormat(String roleFormat) {
		this.roleFormat = roleFormat;
	}

	public void setIncrementType(String incrementType) {
		this.incrementType = incrementType;
	}

	public void setIncrementVal(Integer incrementVal) {
		this.incrementVal = incrementVal;
	}

	public void setInitVal(Integer initVal) {
		this.initVal = initVal;
	}

	public void setCurVal(Long curVal) {
		this.curVal = curVal;
	}

	public void setRefDate(Date refDate) {
		this.refDate = refDate;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@Override
	public String toString() {
		ToStringBuilder sb = new ToStringBuilder(this, ToStringStyle.DEFAULT_STYLE);
		sb.append("roleId",this.id)
		  .append("roleName",this.roleName)
		  .append("format",this.roleFormat)
		  .append("description",this.description);
		
		return sb.toString();
	}

	@Override
	public boolean equals(Object o) {
		if(this == o) {
			return true;
		}
		if(!(o instanceof SysNumberRole)) {
			return false;
		}
		final SysNumberRole role = (SysNumberRole)o;
		if(id != null) {
			return id.equals(role.getId());
		} else {
			return role.id == null;
		}
	}

	@Override
	public int hashCode() {
		return (this.id != null ? this.id.hashCode() : 0);
	}

}
